package com.sanyang.pda.presenter;


import com.sanyang.pda.bean.ManualPickingBean;
import com.sanyang.pda.bean.SearchStockDetailBean;
import com.sanyang.pda.bean.StockStatisticsBean;
import com.sanyang.pda.contract.ManualOutBoundContract;
import com.sanyang.pda.contract.StockSearchContract;
import com.sanyang.pda.net.NetUtils;
import com.wangshen.base.net.bean.BaseAppEntity;
import com.wangshen.base.net.bean.BaseRowsAppEntity;
import com.wangshen.base.ui.mvp.base.presenter.BasePresenter;

import java.util.List;

import io.reactivex.functions.Consumer;

public class StockSearchPresenter extends BasePresenter<StockSearchContract.View> implements StockSearchContract.Presenter {

    @Override
    public void inventoryQuery(String storagebinId) {
        NetUtils.geApi().inventoryQuery(storagebinId)
                .compose(this.handleEverythingResult())
                .subscribe(new Consumer<BaseAppEntity<SearchStockDetailBean>>() {
                    @Override
                    public void accept(BaseAppEntity<SearchStockDetailBean> listBaseAppEntity) throws Exception {
                        getView().setData(listBaseAppEntity.getData());
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        getView().showMessage(throwable.getMessage());
                    }
                });
    }
}
